import logging
import unittest
import requests
from api.ihrm_curd_api import IhrmCurd
from common.assert_util import api_assert
class IhrmApi(unittest.TestCase):
    session=None
    @classmethod
    def setUpClass(cls) -> None:
        cls.session = requests.Session()
    def test_create(self):
        header = {"Content-Type": "application/json", "Authorization": "27fe1949-d1cf-4d52-a1d2-4381cb4bcada"}
        body = {"username": "张四", "mobile": "15722589458", "workNumber": "003"}
        res = IhrmCurd.create(header, body, self.session)
        print(res.json())
        logging.info(res.json())
        code=res.json().get("code")
        message=res.json().get("message")
        api_assert(self,res,200,"操作成功",True)

    def test_query(self):
        ihrm_id = "1506229335512702976"  # 1066239913642561536
        header = {"Content-Type": "application/json", "Authorization": "27fe1949-d1cf-4d52-a1d2-4381cb4bcada"}
        res = IhrmCurd.query(ihrm_id, header, self.session)
        print(res.json())

